package com.cooge.jiexi;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.URL;

public class daili {

	public static void main(String[] args) throws Exception{
		Socket soc = new Socket(new URL("http://www.115.com/").getHost(), 80);
		
		OutputStream out = soc.getOutputStream();
		PrintWriter pw = new PrintWriter(out);
		pw.println("GET http://www.115.com/ HTTP/1.1");
		pw.println("Host: www.115.com");
		pw.println("Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
		pw.println("User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36");
		pw.println("Proxy-Connection:keep-alive");
		pw.println();
		pw.flush();
		InputStream inps = 	soc.getInputStream();
		InputStreamReader ri = new InputStreamReader(inps);
		BufferedReader br = new BufferedReader(ri);
		String line = null;
		while((line = br.readLine())!=null){
			System.out.println(line);
		}
		pw.close();
	}
}
